package com.sqjw.demo.config;import com.sqjw.demo.util.SqliteBuilder;import com.sqjw.demo.util.SqliteUtils;import org.springframework.beans.factory.annotation.Value;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import javax.sql.DataSource;import java.sql.SQLException;//@Configurationpublic class SqliteConfig {    //数据源url    @Value("${spring.datasource.url}")    private String dataSourceUrl;    /**     * 配置sqlite数据源     * @return     */    @Bean(name = "sqliteDataSource")    public DataSource sqliteDataSource(){        //创建数据源        DataSource dataSource  = SqliteBuilder.create().url(dataSourceUrl).build();        try {            //尝试初始化数据库-表不存在时创建            SqliteUtils.initProDb(dataSource.getConnection());        } catch (SQLException e) {            e.printStackTrace();        }        return dataSource;    }}